package com.ruoyi.model.blog;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@TableName("web_blog")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Blog extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 文章id
     */
    @TableId(type = IdType.ASSIGN_ID)
    private String id;

    /**
     * 博文标题
     */
    @Excel(name = "博文标题")
    private String title;

    /**
     * 发布者id
     */
    @Excel(name = "发布者id")
    private String pushId;

    @TableField(exist = false)
    private String pushName; //发布者name

    /**
     * 文章图片
     */
    @Excel(name = "文章图片")
    private String imagrUrl;

    /**
     * 发布时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "发布时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date pushTime;

    /**
     * 文章内容
     */
    @Excel(name = "文章内容")
    private String content;

    /**
     * 文章摘要
     */
    @Excel(name = "文章摘要")
    private String summary;

    /**
     * 是否置顶
     */
    @Excel(name = "是否置顶")
    private String isTop;

    /**
     * 状态
     */
    @Excel(name = "状态")
    private String status;

    /**
     * 浏览量
     */
    @Excel(name = "浏览量")
    private Integer viewCount;

    /**
     * 是否允许评论
     */
    @Excel(name = "是否允许评论")
    private String isComment;

    /**
     * 逻辑删除
     */
    @Excel(name = "逻辑删除")
    @TableLogic
    private String isDel;

    public Blog(String id, Integer viewCount) {
        this.id = id;
        this.viewCount = viewCount;
    }
}
